<script setup>
import { onMounted } from 'vue'
import * as echarts from 'echarts'
import { setupChartAnimation } from '@/utils/animation'

onMounted(() => {
  // 基于准备好的dom，初始化echarts实例
  var myChart = echarts.init(document.querySelector('.venueecharts'))
  // 绘制图表
  myChart.setOption({
    title: {
      textStyle: {
        fontWeight: 'normal',
        fontSize: 16,
        color: '#F1F1F3'
      },
      left: '6%'
    },
    tooltip: {
      trigger: 'axis',
      axisPointer: {
        lineStyle: {
          color: '#57617B'
        }
      }
    },
    grid: {
      left: '3%',
      right: '4%',
      top: '15%',
      bottom: '0%',
      containLabel: true
    },
    xAxis: [{
      type: 'category',
      boundaryGap: false,
      axisLine: {
        show: false,
        lineStyle: {
          color: '#d4e7ef'
        }
      },
      axisTick: {
        show: false
      },
      data: ['1802', '1803', '1804', '1805', '1806', '1807', '1808', '1809', '1810']
    }],
    yAxis: [{
      type: 'value',
      axisTick: {
        show: false
      },
      axisLine: {
        lineStyle: {
          color: '#d4e7ef'
        }
      },
      axisLabel: {
        margin: 10,
        formatter: '{value} k',
        textStyle: {
          fontSize: 14
        }
      },
      splitLine: {
        show: false
      }
    }],
    series: [
      {
        // name: '移动',
        type: 'line',
        smooth: true,
        symbol: 'circle',
        symbolSize: 5,
        showSymbol: false,
        lineStyle: {
          normal: {
            width: 3
          }
        },
        areaStyle: {
          normal: {
            color: new echarts.graphic.LinearGradient(0, 0, 1, 0, [{
              offset: 0,
              color: 'rgba(16,97,204, 0.3)'
            }, {
              offset: 0.8,
              color: 'rgba(17,235,210, 0)'
            }], false),
            shadowColor: 'rgba(0, 0, 0, 0.1)',
            shadowBlur: 10
          }
        },
        itemStyle: {
          normal: {

            color: new echarts.graphic.LinearGradient(0, 0, 1, 0, [{
              offset: 0,
              color: 'rgba(72, 183, 143,1)'
            }, {
              offset: 0.5,
              color: 'rgba(99, 118, 190,1)'
            }, {
              offset: 1,
              color: 'rgba(25, 98, 101,1)'
            }])
          },
          emphasis: {
            color: 'rgb(0,196,132)',
            borderColor: 'rgba(0,196,132,0.2)',
            extraCssText: 'box-shadow: 8px 8px 8px rgba(0, 0, 0, 1);',
            borderWidth: 10
          }
        },
        data: [10, 25, 5, 15, 19, 9, 16, 10, 25]
      }
    ]
  })
  window.addEventListener('resize', () => {
    myChart.resize()
  })
  setupChartAnimation(myChart)
})

</script>

<template>
  <div></div>
</template>

<style scoped></style>